
export default {
  namespaced: true,
  state: {
    user: {
      id: '',
      username: '',
      nickname: '',
      avatar: '',
      sex: '',
      mobile: ''
    },
    token: {
      user_id: '',
      token: "",
      expired_at: '',
      updated_at: ''
    },
    chatToken: ""
  },
  getters: {
  },
  mutations: {
    SET_TOKEN: (state, data) => {
      state.chatToken = data
      localStorage.setItem("chatToken", state.chatToken)
    },
    SET_USER: (state, data) => {
      state.user = data
    }
  },
  actions: {
    // 登录
    async login({commit},params) {
      commit("SET_TOKEN", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiVmtWOU96cHh4Vm9xTDJITDhxVUxKYjdQeGZaYUdYSm4iLCJ1c2VySWQiOjF9.G_U3aXYq_9HM4keLXWKMj89eoZu73ItfWvwAnnKjcn0")
      return 'ok'
    },
    // 获取用户信息
    async getUser({ commit }) {
      // const res = await selfInfoApi()
      commit("SET_USER")
      return ""
    }
  }
}
